<%@ Control language="C#" Inherits="YourCompany.Modules.TweetNuke.ViewTweetNuke" CodeFile="ViewTweetNuke.ascx.cs" AutoEventWireup="true"%>
<%@ Register TagPrefix="dnn" TagName="Audit" Src="~/controls/ModuleAuditControl.ascx" %>
<%@ Register Assembly="DotNetNuke.WebControls" Namespace="DotNetNuke.UI.WebControls" TagPrefix="DNN" %>
<%@ Register TagPrefix="dnn" Assembly="DotNetNuke" Namespace="DotNetNuke.UI.WebControls"%>
<style type="text/css">
    ul#tweetList
    {
    	padding-left:0;
    }
    ul#tweetList li
    {
    	list-style-type:none;
    	width:600px;
    	background-color:#E2F1FE;
    	border:1px solid #333;
    	margin-top:3px;
    }
    ul#tweetList li.following 
    {
    	background-color:#C62127;
    }
    ul#tweetList li.following div#tweetTxt
    {
    	color:#FFF !important;
    }
    
    .TweetTA 
    {
    	display: block;
    	vertical-align:top;
        float: left;
    }
    
    .clear 
    {
    	clear:both;
    }
    
    div.userinfo {
        vertical-align:center;
        display: block;
        top:-7px;
        position:relative;
        float: right;
    }
    
    div.userinfo span.row {
        display: block;
        width: 200px;
        font-weight: bold;
    }
    
    div.userinfo span.row span {
        font-weight: normal !important;
    }
    
    span#txtTweetCount
    {
    	color: rgb(204, 204, 204);
    	Display:block;
    	text-align:right;
    	width:600px;
    	font-size:20px;
    }
    
    .status-btn 
    {
        float:right;
        padding:5px 12px 0 5px;
        background-image:url('http://s.twimg.com/a/1260902901/images/round-btn.gif');
        width:115px;
        height:32px;
        border:0;
        color:#666;
        font-size:14px;
        margin-top:3px;
        margin-left:3px;
    }  
    
    .status-btn:hover
    {
    	background-image:url('http://s.twimg.com/a/1260902901/images/round-btn-hover.gif');
    	color:#444;
    }
    .round-btn{}
    
    div.trendspanel {
        float: right;
        width: 205px;
    }
    div.trendspanel h1 {
        margin-left: 10px;
    }
    ul.trends {
        padding-left: 5px;
    }
    ul.trends li {
        list-style-type: none;
        margin-left: 0;
        padding-left: 0;
    }
</style>

<script type="text/javascript">
    function calcTxt(e) {
        var max = 140;
        if (!e) var e = window.event;
        var src = e.target ? e.target : e.srcElement;
        var count = document.getElementById('txtTweetCount');
        if (src && count) {
            count.innerHTML = max - src.value.length;
        }
    }
    
    function refresh() {
        if  (window.location.href.indexOf('#txtTweetCount') > -1) {
            location.reload(true);
        } else {
            window.location = window.location.href + '#txtTweetCount';
        }
    }
    setTimeout(refresh, 60000);
</script>
<br />
<asp:Panel ID="pnAddTweet" runat="server" Visible="false" CssClass="TweetTA">
    <span id="txtTweetCount">140</span>
    <asp:TextBox ID="txtTweet" Columns="40" Rows="4" Height="4.5em" Width="600" MaxLength="150" runat="server" style="padding: 4px 2px;"></asp:TextBox>
    <br />
    <asp:Button ID="btnAddTweet" runat="server" Text="Add tweet" 
        onclick="btnAddTweet_Click" CssClass="status-btn" />
</asp:Panel>
<asp:Panel ID="pnUserInfo" runat="server" CssClass="userinfo" Visible="false">
    <table>
        <tr>
            <td>
                <asp:Image ID="imgUserPic" runat="server" Width="60px" Height="60px"/>
            </td>
            <td>
                <h1><asp:Label ID="lblUserName" runat="server"></asp:Label></h1>
                <asp:Label CssClass="row" ID="lblFollowers" runat="server">Followers: <asp:Label ID="lblFollowersCount" runat="server"></asp:Label></asp:Label>
                <asp:Label CssClass="row" ID="lblFriends" runat="server">Friends: <asp:Label ID="lblFriendsCount" runat="server"></asp:Label></asp:Label>
                <asp:Label CssClass="row" ID="lblUserLoca" runat="server">Location: <asp:Label ID="lblLocation" runat="server"></asp:Label></asp:Label>
                <asp:Label CssClass="row" ID="lblDescription" runat="server">Description: <asp:Label ID="lblDescText" runat="server"></asp:Label></asp:Label><br />
                <asp:HyperLink ID="hlEdit" Visible="false" runat="server"><asp:Image ID="Image1" Runat="server" ImageUrl="~/images/edit.gif" AlternateText="Edit" Visible="true" resourcekey="Edit"/></asp:HyperLink>
            </td>
        </tr>
    </table>
</asp:Panel>
<div class="clear"></div>
<asp:Label ID="lblNoTweets" runat="server" Visible="false">No Tweets Available</asp:Label>
<asp:Panel ID="pnTrends" CssClass="trendspanel" runat="server" Visible="false">
    <asp:Repeater ID="rptTrends" runat="server">
        <HeaderTemplate>
            <h1>Trends</h1>
            <ul class="trends">
        </HeaderTemplate>
        <ItemTemplate>
            <li>
                <a href='<%#Eval("value") %>'><%#Eval("key") %></a>
            </li>
        </ItemTemplate>
        <FooterTemplate>
            </ul>
        </FooterTemplate>
    </asp:Repeater>
</asp:Panel>
<asp:Repeater ID="rptTweetList" runat="server">
    <HeaderTemplate>
        <ul id="tweetList"><!--starttweetlist-->
    </HeaderTemplate>
    <ItemTemplate>
        <li class='<%# XPath("@from") %>'>
            <table>
                <tr>
                    <td><div style="display:inline-block;"><asp:Image ImageUrl='<%# XPath("user/profile_image_url") %>' Height="30" runat="server" /></div></td>
                    <td><div style="display:inline-block;" id="tweetTxt"><%# XPath("text") %><br />
                        <span style="font-size:11px"><i><%# parseTwitterXmlDate(XPath("created_at") as string).ToString("ddd, dd MMM yyyy HH:mm") %></i></span>
                    </td>
                </tr>
            </table>
        </li>
    </ItemTemplate>
    <FooterTemplate>
        <!--endtweetlist--></ul>
    </FooterTemplate>
</asp:Repeater>